﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<eCRAM.WebSite.Models.EditActivityModel>" %>
<%@ Import Namespace="eCRAM.Model" %>
<%@ Import Namespace="eCRAM.WebSite.Models" %>
<%@ Import Namespace="eCRAM.WebSite.Tools" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	eCram - Edition d'une activité
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Editer une activite</h2>

    <% using (Html.BeginForm("ValidateActivity", "ReferenceData")) {%>
        <%: Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Activité</legend>
            <%: Html.HiddenFor(model => model.Id) %>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Name) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Name) %>
                <%: Html.ValidationMessageFor(model => model.Name) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.StartDate) %>
            </div>
            <div class="editor-field">
                <%: Html.DateBoxFor(Model, model => model.StartDate) %>
                <%: Html.ValidationMessageFor(model => model.StartDate) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.EndDate) %>
            </div>
            <div class="editor-field">
                <%: Html.DateBoxFor(Model, model => model.EndDate)%>
                <%: Html.ValidationMessageFor(model => model.EndDate) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.TypeId)%>
            </div>
            <div class="editor-field">
                <%: Html.DropDownListFor(model => model.TypeId,
                    (ViewData["listActivityTypes"] as IEnumerable<ActivityType>).Select(a => new SelectListItem { Text = a.Label, Value = a.Id.ToString(), Selected = (a.Id == Model.TypeId) }))%>
                <%: Html.ValidationMessageFor(model => model.TypeId)%>
            </div>
            
         

             <div class="editor-label">
                <%: Html.LabelFor(model => model.ProjectLeader)%>
            </div>
            <div class="editor-field">
                <%: Html.DropDownListFor(model => model.ProjectLeader, ViewData.GetUsersList().AddEmptyListItem())%>
                <%: Html.ValidationMessageFor(model => model.ProjectLeader)%>
            </div>

            <div class="editor-label">
                <%: Html.LabelFor(model => model.IsAstreinte) %>
            </div>
            <div class="editor-field">
                <%: Html.CheckBoxFor(model => model.IsAstreinte)%>
                <%: Html.ValidationMessageFor(model => model.IsAstreinte)%>
            </div>

            <div class="editor-label">
                <%: Html.LabelFor(model => model.IsActive) %>
            </div>
            <div class="editor-field">
                <%: Html.CheckBoxFor(model => model.IsActive) %>
                <%: Html.ValidationMessageFor(model => model.IsActive) %>
            </div>
       
        </fieldset>
     <p>
                <input type="submit" value="Sauvegarder" />
            </p>
    <% } %>

    <div>
        <%: Html.ActionLink("Retour", "SelectDataType", new {DataType = (int)EnumDataType.Activites}) %>
    </div>

</asp:Content>

